home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / CpuMuxExceptions.h < prev    next >
C/C++ Source or Header  |  1990-07-09  |  2KB  |  80 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. // 
  3. // Copyright (C) 1988 University of Illinois, Urbana, Illinois
  4. // Copyright (C) 1989 University of Colorado, Boulder, Colorado
  5. // Copyright (C) 1990 University of Colorado, Boulder, Colorado
  6. //
  7. // written by Dirk Grunwald (grunwald@foobar.colorado.edu)
  8. //
  9. #ifndef CpuMuxExceptions_h
  10. #define CpuMuxExceptions_h
  11. #pragma once
  12.  
  13. #include <ExceptionClass.h>
  14.  
  15. //
  16. //    ExceptionByReserve -- Used to reserve a semaphore/barrier/etc
  17. //
  18. class ReserveByException;
  19.  
  20. class ExceptionReserve : public ExceptionClass {
  21.     ReserveByException *toReserve;
  22. public:
  23.     ReserveByException *reserve();
  24.     void reserve(ReserveByException *);
  25.     
  26.     virtual void handleException();
  27. };
  28.  
  29. static inline ReserveByException *
  30. ExceptionReserve::reserve()
  31. {
  32.     return(toReserve);
  33. }
  34.  
  35. static inline void
  36. ExceptionReserve::reserve(ReserveByException *r)
  37. {
  38.     toReserve = r;
  39. }
  40.  
  41.  
  42. //
  43. //    ExceptionTerminate -- used to terminate a thread
  44. //
  45. class Thread;
  46.  
  47. class ExceptionTerminate : public ExceptionClass {
  48.     Thread *deadThread; 
  49. public:
  50.     void terminate(Thread *);
  51.     virtual void handleException();
  52. };
  53.  
  54. static inline void
  55. ExceptionTerminate::terminate(Thread *r)
  56. {
  57.     deadThread = r;
  58. }
  59.  
  60. //
  61. //    ExceptionReschedule -- used to relenquish the CPU.
  62. //
  63.  
  64. class ExceptionReschedule : public ExceptionClass {
  65. public:
  66.     virtual void handleException();
  67. };
  68.  
  69. //
  70. //    ExceptionIveSuspended -- used when current thread has suspended
  71. //    itself and another thread must be scheduled and run.
  72. //
  73.  
  74. class ExceptionIveSuspended : public ExceptionClass {
  75. public:
  76.     virtual void handleException();
  77. };
  78.  
  79. #endif /* CpuMuxExceptions_h */
  80.